import 'dart:convert';

import 'package:flutterproject/generated/json/base/json_field.dart';
import 'package:flutterproject/generated/json/my_group_bean.g.dart';

@JsonSerializable()
class MyGroupBean {
  List<MyGroupChildren>? children;
  int? level;
  int? shareNum;
  int? teamAmount;

  MyGroupBean();

  factory MyGroupBean.fromJson(Map<String, dynamic> json) =>
      $MyGroupBeanFromJson(json);

  Map<String, dynamic> toJson() => $MyGroupBeanToJson(this);

  MyGroupBean copyWith(
      {List<MyGroupChildren>? children,
      int? level,
      int? shareNum,
      int? teamAmount}) {
    return MyGroupBean()
      ..children = children ?? this.children
      ..level = level ?? this.level
      ..shareNum = shareNum ?? this.shareNum
      ..teamAmount = teamAmount ?? this.teamAmount;
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class MyGroupChildren {
  int? createTime;
  int? level;
  String? mobile;
  int? myAmount;
  int? teamAmount;

  MyGroupChildren();

  factory MyGroupChildren.fromJson(Map<String, dynamic> json) =>
      $MyGroupChildrenFromJson(json);

  Map<String, dynamic> toJson() => $MyGroupChildrenToJson(this);

  MyGroupChildren copyWith(
      {int? createTime,
      int? level,
      String? mobile,
      int? myAmount,
      int? teamAmount}) {
    return MyGroupChildren()
      ..createTime = createTime ?? this.createTime
      ..level = level ?? this.level
      ..mobile = mobile ?? this.mobile
      ..myAmount = myAmount ?? this.myAmount
      ..teamAmount = teamAmount ?? this.teamAmount;
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}
